<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../static/webix/webix.css" type="text/css"
	charset="utf-8">
<script src="../static/webix/webix.js" type="text/javascript"
	charset="utf-8"></script>
</head>
<body>
	<script type="text/javascript" charset="utf-8">
		var form = {
			view : "form",
			borderless : true,
			elements : [ {
				view : "text",
				label : '用户名：',
				name : "username",
				invalidMessage: "用户名不能为空哦！"
			}, {
				view : "text",
				label : '密  码：',
				type:"password",
				name : "password"
			}, {
				view : "button",
				value : "登录",
				click : function() {
					if (this.getParentView().validate()) { //validate form
						webix.message("All is correct");
						this.getTopParentView().hide(); //hide window
					} else
						webix.message({
							type : "error",
							text : "Form data is invalid"
						});
				}
			} ],
			rules : {
				"username" : webix.rules.isNotEmpty,
				"password" : webix.rules.isNotEmpty
			},
			elementsConfig : {
				labelPosition : "top",
			}
		};

		webix.ui({
			view : "window",
			id : "win2",
			width : 300,
			position : "center",
			modal : true,
			head : "用户登录",
			body : webix.copy(form)
		}).show();
	</script>
</body>
</html>